<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<% 
String path=request.getContextPath(); 
String basePath=request.getScheme()+ "://" + request.getServerName() + ":" + request.getServerPort() + path+ "/"; 
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<base href="<%=basePath%>">
<title>发票推送配置</title>

<%@ include file="/WEB-INF/jsp/common/common.jsp" %>
<script src="<%=path%>/js/jquery.divbox.js" type="text/javascript"></script>
<style type="text/css">
		#detail
        {
            position:relative; 
            font-size: 12px;
            background: #fff;
            border: 1px solid #000;
            z-index: 2;
            display: none;
        } 
        #detail2
        {
            position:relative;
            font-size: 12px;
            background: #fff;
            border: 1px solid #000;
            z-index: 2;
            display: none;
        } 
	</style>
</head>

<script type="text/javascript">
	$(document).ready(function() {
		loadPrivilegeBranchSelect();//加载机构下拉框
	});
	
	//------------------------------------------ 机构 开始----------------------------------------------
	//加载机构下拉框
	function loadPrivilegeBranchSelect(){
		$.ajax({
				url : "<%=path%>/pushInfoManagerController/queryPrivilegeBranch?"+new Date().getTime(),
				type : 'POST',
				async : false,
				dataType:'json',
				success : function(result) {
					if(result){
						if($.validate(result))return;
						//接口下拉框对象
						var privilegeBranchSelect = document.getElementById("privilegeBranch");
						privilegeBranchSelect.length=0;
						
						var data = result.data;
						if(data.length > 0){
							defaultBranch = data[0].deptCode;
							for (var i = 0; i < data.length; i++) {
								var option = new Option();
								option.text = data[i].deptCname;
								option.title = data[i].deptCname;
								option.value = data[i].deptCode;
								privilegeBranchSelect.add(option);
							}
						}
						
					}
				}
			});
	 }
	//所选机构改变时，清空相关联数据
	function clearBranchRelaField(){
		$("#dptCode").val("");
		$("#partnerNo").val("");
	}
	//------------------------------------------ 机构 结束----------------------------------------------

	//------------------------------------------ 出单机构 开始----------------------------------------------
	//打开出单机构窗口
	function openDeptDiv(pageIndex,obj){
		
		if($.trim($('#privilegeBranch').val()).length == 0){
			$.message("error", "请先选择机构");
			return;
		}
		
		$('#deptCode').val('');
		$('#deptCname').val('');
		$("#"+obj.id).blur();
		queryCoreDept(pageIndex);
	}
	//查询出单机构
	function queryCoreDept(pageIndex){
		var size = 8;
		var deptCode = $.trim($('#deptCode').val());
		var deptCname = $.trim($('#deptCname').val());
		var parentDeptCode =  $.trim($('#privilegeBranch').val());
		
		$.openLoading();
		$.ajax({
			url : "<%=path%>/pushInfoManagerController/queryDeptByDeptAndParentDeptCode",
			type : 'POST',
			async : true,
			data:{
				size:size,
				pageIndex:pageIndex,
				deptCode:deptCode,
				deptCname:deptCname,
				parentDeptCode:parentDeptCode
			},
			dataType:'json',
			success:function(page){
				$.closeLoading();
				if($.validate(page))return;
				
				var radioObj ="<input class='input_fxk' name='deptradio' type='radio' value=''>";
				var fieldNames = "deptCode,deptCNname";
				var tableContent = creatTable1(fieldNames,page,radioObj);
				var tableObj = $("#deptTable");
				tableObj.find("tbody").remove();
				tableObj.append(tableContent);
				
				var strPage = creatChannelPage3(pageIndex,6,page.maxPage,"18");
				var pageDIV = $("#deptPageDIV");
				pageDIV[0].innerHTML="";
				pageDIV.append(strPage);
				
				$("#deptDiv").OpenDiv();
				
				bindradio();
			}
		});
	}
	//点击“确定” ，选择 出单机构
	function chooseDept(){
		var selectedDept= $("input[name='deptradio']:checked");
		if(selectedDept.length==0){
			$.message("error", "请选择一个出单机构");
			return;
		}
		var deptCode = selectedDept.parent().parent().children(" td:eq(1)").html();
		$('#dptCode').val(deptCode);
		
		closeCurrentDIV('deptDiv');
	}
	//------------------------------------------ 出单机构 结束----------------------------------------------
	
	//------------------------------------------ 合作伙伴 开始----------------------------------------------
	//打开合作伙伴 窗口
	function openChannelInfoDiv(pageIndex,obj){
		if(($.trim($('#privilegeBranch').val())).length==0){
			$.message('error',"请先选择机构");
			return;
		}
		$('#channelCode').val('');
		$('#channelName').val('');
		$("#"+obj.id).blur();
		queryTradPartners(pageIndex);
	}
	
	//查询 合作伙伴
	function queryTradPartners(pageIndex){
		var size = 8;
		var parentDeptCode = $.trim($('#privilegeBranch').val());
		var channelCode = $.trim($('#channelCode').val());
		var channelName = $.trim($('#channelName').val());
		
		$.openLoading();
		$.ajax({
			url : "<%=path%>/pushInfoManagerController/queryChannelInfo",
			type : 'POST',
			async : true,
			data:{
				pageIndex:pageIndex,
				size:size,
				parentDeptCode:parentDeptCode,
				channelCode:channelCode,
				channelName:channelName
			},
			dataType:'json',
			success:function(page){
				$.closeLoading();
				if($.validate(page))return;
				
				var radioObj ="<input class='input_fxk' name='partnerradio' type='radio' value=''>";
				var fieldNames = "channelCode,channelName";
				var tableContent = creatTable1(fieldNames,page,radioObj);
				var tableObj = $("#channelInfoTable");
				tableObj.find("tbody").remove();
				tableObj.append(tableContent);
				
				var strPage = creatChannelPage2(pageIndex,6,page.maxPage,"16");
				var pageDIV = $("#channelInfoPageDIV");
				pageDIV[0].innerHTML="";
				pageDIV.append(strPage);
				
				$('#channelInfoDiv').OpenDiv();
				
				bindradio();
			}
		});
	}
		
	//点击“确定”按钮，选择合作伙伴
	function choosePartner(){
		var selectedPartner = $("input[name='partnerradio']:checked");
		if(selectedPartner.length==0){
			$.message("error", "请选择一个合作伙伴");
			return;
		}
		var selectedPartnerNo = selectedPartner.parent().parent().children(" td:eq(1)").html();
		$('#partnerNo').val(selectedPartnerNo);		
		closeCurrentDIV('channelInfoDiv');
		queryIsPushInvioce(selectedPartnerNo);
	}	
	//------------------------------------------ 合作伙伴 结束----------------------------------------------

	//统一 关闭窗口(传入要关闭DIV的id)
	function closeCurrentDIV(obj){
			$("#"+obj).CloseDiv();	
	}
	
	//“重置”查询条件
	function  resetCriteria(){
		$("#privilegeBranch").val(defaultBranch);//机构置为默认机构
		$("#dptCode").val("");
		$("#partnerNo").val("");
		$("#status").val("");
		$("#polNo").val("");
    	$('#pushBtn').attr("disabled",false);
	}
	// 校验查询条件
	function checkConditions() {
		var privilegeBranch = $.trim($("#privilegeBranch").val());//机构
        var dptCode = $.trim($("#dptCode").val());//出单机构
        var partnerNo = $.trim($("#partnerNo").val());//合作伙伴
        var polNo =$.trim($("#polNo").val());//保单号
        var status =$.trim($("#status").val());//保单状态
        var jsonDate = {
                privilegeBranch:privilegeBranch,
                dptCde:dptCode,
                partnerNo:partnerNo,
                polNo:polNo,
                status:status
            }
        return jsonDate
	}
	
	//查询发票
	function queryInvioce(pageIndex){
		var jsonDate = checkConditions()
		if(pageIndex == null){
			pageIndex = 1;
		}
		if(pageIndex == -1){
			pageIndex = 1;
		}
		
		var asyncFlag = true;
		if(pageIndex == -1){
			asyncFlag = false;
		}
		jsonDate.pageIndex = pageIndex
		$.openLoading();
		$.ajax({
			url: "pushInfoManagerController/queryInviocePageByCriteria",
			type: 'POST',
			async: asyncFlag,
			data: jsonDate,
			dataType: 'json',
			success:function(page){
			    $.closeLoading();
				startP = page.current;
				var firstbutton='';
				var sms="<a href='javascript:void(this)' style='font-size:12px;display: block;overflow: hidden;white-space: nowrap;text-align:center;-o-text-overflow: ellipsis;text-overflow: ellipsis;width:120px;font-family:宋体;font-weight:normal' onDblClick='copyDetail(this);' onclick='showDatail(this);return false' onmouseover='showDatail(this);return false' onmouseout='closeDatail(this);return false'>SMS_TEMPLATE_CODE</a>";
				var mail="<a href='javascript:void(this)' style='font-size:12px;display: block;overflow: hidden;white-space: nowrap;text-align:center;-o-text-overflow: ellipsis;text-overflow: ellipsis;width:120px;font-family:宋体;font-weight:normal' onDblClick='copyDetail(this);' onclick='showDatail(this);return false' onmouseover='showDatail(this);return false' onmouseout='closeDatail(this);return false'>MAIL_SHOW</a>";
				firstbutton ="<input class='input_fxk' name='checkData' type='checkBox' value='#'>";
				var lastbutton = "<a href='javascript:void(0)' onClick='editPage(this);return false'>编辑</a>";
				var tableContent = creatTable1("POLNO,INVOICEHEAD,BUYERNO,ADDRESSEE,ADDRESSEETEL,ADDRESS,REGADDR,BANKINFO,BANKACC,PHONENO,INVOICETYPE,EXPCOMPANY,YDH,STATUS,ID@TDH,CHANNELCODE@TDH",page,firstbutton,lastbutton);				var tableObj = $("#invioceTable");
				tableObj.find("tbody").remove();
				tableObj.append(tableContent);
				var strPage = creatChannelPage2(startP,6,page.maxPage,"97");
				var pageDIV = $("#inviocePageDIV");
				pageDIV[0].innerHTML="";
				pageDIV.append(strPage);
			}
		});
	}
	
	//编辑页面
	function editPage(obj){
		var editTr = $(obj).parent('td').parent('tr')[0];
		var polno = editTr.childNodes[1].innerHTML;
		var invoiceHead = editTr.childNodes[2].innerHTML;
		var buyerNo = editTr.childNodes[3].innerHTML;
		var addressee = editTr.childNodes[4].innerHTML;
		var addresseeTel = editTr.childNodes[5].innerHTML;
		var address = editTr.childNodes[6].innerHTML;
		var regaddr = editTr.childNodes[7].innerHTML;
		var bankInfo = editTr.childNodes[8].innerHTML;
		var bankAcc = editTr.childNodes[9].innerHTML;
		var phoneNo = editTr.childNodes[10].innerHTML;
		var expCompany = editTr.childNodes[12].innerHTML;
		var YDH = editTr.childNodes[13].innerHTML;
		var ID = editTr.childNodes[15].innerHTML;
		$('#polno').val(polno);
		$('#invoiceHead').val(invoiceHead);
		$('#buyerNo').val(buyerNo);
		$('#addressee').val(addressee);
		$('#addresseeTel').val(addresseeTel);
		$('#address').val(address);
		$('#regaddr').val(regaddr);
		$('#bankInfo').val(bankInfo);
		$('#bankAcc').val(bankAcc);
		$('#phoneNo').val(phoneNo);
		$('#expCompany').val(expCompany);	
		$('#YDH').val(YDH);
		$('#editId').val(ID);
		$('#addtempletDiv').OpenDiv();
	}

	//发票信息修改保存
	function saveInvioce(){
		var polno = $('#polno').val();
		var invoiceHead = $('#invoiceHead').val();
		var buyerNo = $('#buyerNo').val();
		var addressee = $('#addressee').val();
		var addresseeTel = $('#addresseeTel').val();
		var address = $('#address').val();
		var regaddr = $('#regaddr').val();
		var bankInfo = $('#bankInfo').val();
		var bankAcc = $('#bankAcc').val();
		var phoneNo = $('#phoneNo').val();
		var expCompany = $('#expCompany').val();	
		var YDH = $('#YDH').val();
		var ID = $('#editId').val();
		$.openLoading();
		$.ajax({
			url : "pushInfoManagerController/saveInvioce",
			type : 'POST',
			async : true,
			data:{polno:polno,invoiceHead:invoiceHead,buyerNo:buyerNo,addressee:addressee,addresseeTel:addresseeTel,address:address,
				regaddr:regaddr,bankInfo:bankInfo,bankAcc:bankAcc,phoneNo:phoneNo,expCompany:expCompany,YDH:YDH,ID:ID},
			dataType:'json',
			success:function(result){
				$.closeLoading();
				$.message(result.result, result.message);
				if(result.result=='success'){
					closeCurrentDIV('addtempletDiv');
					queryInvioce();
				}
			}
		});
	}
	
	//推送功能之前的处理
	function beforePushInvioce(){
		var channelCodeStr='';
		$("input[name='checkData']:checked").each(function(){
			if(''==channelCodeStr){
				channelCodeStr = $(this).parent().parent().children("td:eq(16)").html()
			}else{
				channelCodeStr =channelCodeStr+","+ $(this).parent().parent().children("td:eq(16)").html()
			}
		});
		var invioceIDStr='';
		$("input[name='checkData']:checked").each(function(){
			if(''==invioceIDStr){
				invioceIDStr = $(this).parent().parent().children("td:eq(15)").html()
			}else{
				invioceIDStr =invioceIDStr+","+ $(this).parent().parent().children("td:eq(15)").html()
			}
		});
		var flag = "1" ; 
		$.ajax({
			url: "pushInfoManagerController/beforePushInvioce",
			type: 'POST',
			async: false,
			data: {channelCodeStr:channelCodeStr,invioceIDStr:invioceIDStr},
			dataType: 'json',
			success:function(result){
				 if(""!=result.message){
					 flag = "0";
					 $.message("error","选择数据中：保单号为"+result.message+"所关联的合作伙伴没有推送发票的权限！");					
				}
			}
		}); 
		return flag;
	}
	
	//推送功能
	function pushInvioce(){
		var invioceIDStr='';
		var polNo = '';
		$("input[name='checkData']:checked").each(function(){
			if(''==invioceIDStr){
				invioceIDStr = $(this).parent().parent().children("td:eq(15)").html()
			}else{
				invioceIDStr =invioceIDStr+","+ $(this).parent().parent().children("td:eq(15)").html()
			}
			var company = $(this).parent().parent().children("td:eq(12)").html();
			var YDH = $(this).parent().parent().children("td:eq(13)").html();
			if(company=="" || YDH==""){
				polNo = polNo+"   /"+ $(this).parent().parent().children("td:eq(1)").html();
			}
		});
		if(polNo!=''){
			$.message("error", "保单号:"+polNo+"   请填写快递公司和运单号！");
			return;
		}
		if(invioceIDStr==''){
			$.message("error", "请至少选择一个数据");
			return;
		}
		var flag = beforePushInvioce();
		if("0"==flag){
			return;
		}		
		$.openLoading();
		$.ajax({
			url: "pushInfoManagerController/pushInvioce",
			type: 'POST',
			async: true,
			data: {invioceIDStr:invioceIDStr},
			dataType: 'json',
			success:function(result){
			    $.closeLoading();
				$.message(result.result, result.message);
			    queryInvioce(1);
			}
		}); 		
	}
	
	//查询是否启用推送功能
	function queryIsPushInvioce(partnerNo){
		$.openLoading();
		$.ajax({
			url: "pushInfoManagerController/queryIsPushInvioce",
			type: 'POST',
			async: true,
			data: {partnerNo:partnerNo},
			dataType: 'json',
			success:function(result){
			    $.closeLoading();
			    if("1"!=result.message){
					$.message("error", "该合作伙伴没有推送发票权限！推送功能已禁用！");
			    	$('#pushBtn').attr("disabled",true);    	
			    }else{
			    	$('#pushBtn').attr("disabled",false);
			    }
			}
		}); 		
	}
	

</script>	
<body>
	<input type="hidden" value="" id='editId' />
	<input type="hidden" value="${privilegeBranch}" id='privilegeBranch0' />
	<div class="current">
          <table class="current_table_1">
             <tbody>
               <tr class="f2">
                 <td><img src="./images/current_1.jpg"></td>
                 <td class="current_table_1_td">
                   <img src="images/current_1.png">&nbsp;您现在的位置：&nbsp;
                     <span style=" color:#136bab; ">推送信息管理
                     <span style="padding:0 5px; font-weight:bold; line-height:28px;">&gt;</span>发票推送配置
                 </span>
                 </td>
                 <td><img src="./images/current_3.jpg"></td>
             </tr>
          </tbody>
        </table>
     </div>
	
	<table class="table_02" id="table">
		<tr>
			<td>
				<table class="search_table" id="queryNlifePlanCriteriaTable">
					<tr height="30px">	
						<td style="padding-left:40px; border: 0;text-align: right" nowrap="nowrap">机&nbsp;&nbsp;构：</td>
						<td style="border: 0;text-align: left;padding-right: 70px">
						   <select class="search_select_1" name="privilegeBranch" id="privilegeBranch" onchange="clearBranchRelaField()" style="width: 206px"></select>
						</td>
						<td style="padding-left:40px;border: 0;text-align: right" nowrap="nowrap">出单机构：</td>
                  		<td style="border: 0;text-align: left;padding-right: 70px">
                  			<input id="dptCode" name="dptCde" type="text" readonly="readonly" style=" background-color: #ccc;" class="input_text">
                  			&nbsp;&nbsp;<input type="button"  class="input_button_5" id="searchDeptBtn" value="请选择" onClick="openDeptDiv(1,this)"/>
                  		</td>
                  		<td style="border: 0;text-align: right;" nowrap="nowrap">保单号：</td>
						<td style="border: 0;text-align: left;padding-right: 70px">
							<input name="polNo" id="polNo" class="input_text" style="width:130px;" size="25"/>
						</td>
					</tr>
					<tr height="25px">
						<td style="border: 0;text-align: right" nowrap="nowrap">合作伙伴：</td>
		                <td style="border: 0 ;text-align: left; padding-right: 70px">
							<input name="partnerNo" id="partnerNo" readonly="readonly" onselect="" style=" background-color: #ccc;" class="input_text">
							&nbsp;&nbsp;<input type="button"  class="input_button_5"  id="searchPartnerBtn" value="请选择" onClick="openChannelInfoDiv(1,this)"/>
		                </td>
		                 <td style="border: 0;text-align: right;" nowrap="nowrap">状&nbsp;&nbsp;态：</td>
						<td style="border: 0;text-align: left;padding-right: 70px">
						   <select class="search_select_1" name="status" id="status">
								<option value="">---请选择---</option>
								<option value="1">待推送</option>							   		
								<option value="2">已推送</option>
						   		<option value="3">推送失败</option>
						   </select>
						</td>
		                <td style="border: 0;text-align: right;padding-left: 70px" >
							<input type="button"  class="input_button_1" id="searchBtn" value="查询" onClick="queryInvioce(1)"/>
							<input type="button" value="重置" onClick="resetCriteria()" class="input_button_1"/>							
						</td>
					</tr>
					
				</table>
			</td>
		</tr>
		<tr style="height: 10px">
			<td>
				<table class="search_table">
					<tr height="30px">
						<td width="100%" height="30">
							 <input type="button" class="input_button_2" id="pushBtn" value="推送" onClick="pushInvioce()"/>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	<tr>
			<td>
				<table id="invioceTable"  class="content_table_1">
			<thead>
			<tr class="f1">
				<th style="width:3%">选择</th>
				<th style="width:9%">保单号</th>
		                  <th style="width:7%">发票抬头</th>
		                  <th style="width:7%">纳税人识别号</th>
		                  <th style="width:6%">收件人姓名</th>
		                  <th style="width:6%">收件人电话</th>
		                  <th style="width:8%">收件人地址</th>
		                  <th style="width:8%">注册地址</th>
		                  <th style="width:8%">开户行</th>
		                  <th style="width:8%">开户账号</th>
				<th style="width:6%">联系电话</th>
				<th style="width:6%">发票类别</th>
				<th style="width:6%">快递公司</th>
				<th style="width:5%">运单号</th>
                
				<th style="width:6%">状态</th>
				<th style="width:5%">操作</th>
			</tr>
			</thead>
			<tbody>
			</tbody>
		</table>
	
    <div id="inviocePageDIV"  class="page"></div>
</td>
		</tr>
	</table>
<!--   	添加模板 DIV 默认隐藏-->
 	<div id="addtempletDiv"  style="display:none;width:60%">
		<input type="hidden" id="row_num" name="row_num" value="0"/>
		<div class="table_title_div">
				<table class="table_title" style='width:100%;'>
					<tr>
						<td width="10%"></td>
						<td width="80%" id="interfaceName"></td>
						<td width="10%" align="right"><img src="<%=path%>/images/closedown.gif" alt="关闭"  onclick="closeCurrentDIV('addtempletDiv')"/></td>
					</tr>
				</table>
		</div>
		<form id="inputForm" action="save.jhtml" method="post" enctype="multipart/form-data">	
			<table class="table_02" id="addtempletTable" align="center" style="margin: 0px auto">
				<tbody>
					<tr>
						<td>
							<table id="productTempletTable"  class="content_table_1">
								<tbody>
									<tr>
										<td width="40%" style="text-align:right;border-right:0px;">保单号：&nbsp;&nbsp;</td>
										<td width="60%" style="text-align:left"><input type="text" style="width: 250px" class="input_text" id="polno" disabled="true"></td>
									</tr>
									<tr>
										<td width="40%" style="text-align:right;border-right:0px;">发票抬头：&nbsp;&nbsp;</td>
										<td width="60%" style="text-align:left"><input type="text" style="width: 250px" class="input_text" id="invoiceHead" disabled="true"></td>
									</tr>
									<tr>
										<td width="40%" style="text-align:right;border-right:0px;">纳税人识别号：&nbsp;&nbsp;</td>
										<td width="60%" style="text-align:left"><input type="text" style="width: 250px" class="input_text" id="buyerNo" disabled="true"></td>
									</tr>
									<tr>
										<td width="40%" style="text-align:right;border-right:0px;">收件人姓名：&nbsp;&nbsp;</td>
										<td width="60%" style="text-align:left"><input type="text" style="width: 250px" class="input_text" id="addressee" disabled="true"></td>
									</tr>
					                <tr>
										<td width="40%" style="text-align:right;border-right:0px;">收件人电话：&nbsp;&nbsp;</td>
										<td width="60%" style="text-align:left"><input type="text" style="width: 250px" class="input_text" id="addresseeTel" disabled="true"></td>
									</tr>
									<tr>
										<td width="40%" style="text-align:right;border-right:0px;">收件人地址：&nbsp;&nbsp;</td>
										<td width="60%" style="text-align:left"><input type="text" style="width: 250px" class="input_text" id="address" disabled="true"></td>
									</tr>
									<tr>
										<td width="40%" style="text-align:right;border-right:0px;">注册地址：&nbsp;&nbsp;</td>
										<td width="60%" style="text-align:left"><input type="text" style="width: 250px" class="input_text" id="regaddr" disabled="true"></td>
									</tr>
									<tr>
										<td width="40%" style="text-align:right;border-right:0px;">开户行：&nbsp;&nbsp;</td>
										<td width="60%" style="text-align:left"><input type="text" style="width: 250px" class="input_text" id="bankInfo" disabled="true"></td>
									</tr>
									<tr>
										<td width="40%" style="text-align:right;border-right:0px;">开户账号：&nbsp;&nbsp;</td>
										<td width="60%" style="text-align:left"><input type="text" style="width: 250px" class="input_text" id="bankAcc" disabled="true"></td>
									</tr>
									<tr>
										<td width="40%" style="text-align:right;border-right:0px;">联系电话：&nbsp;&nbsp;</td>
										<td width="60%" style="text-align:left"><input type="text" style="width: 250px" class="input_text" id="phoneNo" disabled="true"></td>
									</tr>
                                   
									<tr>
										<td width="40%" style="text-align:right;border-right:0px;">快递公司：&nbsp;&nbsp;</td>
										<td width="60%" style="text-align:left"><input type="text" style="width: 250px" class="input_text" id="expCompany"></td>
									</tr>
									<tr>
										<td width="40%" style="text-align:right;border-right:0px;">快递单号：&nbsp;&nbsp;</td>
										<td width="60%" style="text-align:left"><input type="text" style="width: 250px" class="input_text" id="YDH"></td>
									</tr>
								</tbody>
							</table>
						</td>
					</tr>
				</tbody>
			</table>
			<div align="center">
				 <input class="input_button_3" name="" type="button" onclick="saveInvioce()" value="确定">&nbsp;&nbsp;
		         <input class="input_button_3" name="" type="button" onclick="closeCurrentDIV('addtempletDiv')" value="取消">
			</div>
		</form>
	</div>



    <!--选择出单机构 DIV 默认隐藏-->	
	<div id="deptDiv" style="display:none;width:80%;">
		<div class="table_title_div">
			<table class="table_title" style='width:100%;height: 20px;'>
				<tr>
				<td width="10%"></td>
				<td width="80%" id="interfaceName"></td>
				<td width="10%" align="right"><img src="./images/closedown.gif" alt="关闭"  onclick="closeCurrentDIV('deptDiv')"/></td>
				</tr>
			</table>
		</div>
		<table class="table_02" id="table" style="height:180px;" align="center">
			<tr>
				<td>
					<table class="search_table">
						<tr height="30px">
							<td colspan="3" style="text-align:center">
							 出单机构代码：<input name="txt3"  id="deptCode"  type="text" class="input_text" value="" >&nbsp;&nbsp;
							 出单机构名称：<input name="txt3" id="deptCname"  type="text" class="input_text" value="">
								       <input type="button"  class="input_button_1" id="searchBtn" value="查询" onClick="queryCoreDept(1)"/>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table id="deptTable"  class="content_table_1">
						<thead>
							<tr class="f1">
			                  <th style="width:5%">选择</th>
			                  <th style="width:40%">出单机构代码</th>
			                  <th style="width:55%">出单机构名称</th>
			              	</tr>
						</thead>
						<tbody>
						</tbody>
					</table>
					<div id="deptPageDIV"  class="page"></div>
				</td>
			</tr>
		</table>
		<div align="center" >
		  <input type="button" id="saveRoleBtn" value="确定" onclick="chooseDept()" class="input_button_3"/>&nbsp;&nbsp;&nbsp;
		  <input type="button" value="取消" onclick="closeCurrentDIV('deptDiv')" class="input_button_3"/>
		</div>
	</div>
		
	 <!--选择 合作伙伴 div 默认隐藏-->
  	<div id="channelInfoDiv" style="display:none;width:80%;">
		<div class="table_title_div">
			<table class="table_title" style='width:100%;height: 20px;'>
				<tr>
				<td width="10%"></td>
				<td width="80%" id="interfaceName"></td>
				<td width="10%" align="right"><img src="./images/closedown.gif" alt="关闭"  onclick="closeCurrentDIV('channelInfoDiv')"/></td>
				</tr>
			</table>
		</div>
		<table class="table_02" id="table" style="height:180px;" align="center">
			<tr>
				<td>
					<table class="search_table">
						<tr height="30px">
							<td colspan="3" style="text-align:center">
							 合作伙伴代码：<input name="txt3"  id="channelCode"  type="text" class="input_text" value="" >&nbsp;&nbsp;
							 合作伙伴名称：<input name="txt3" id="channelName"  type="text" class="input_text" value="">&nbsp;&nbsp;
								       <input type="button"  class="input_button_1" id="searchBtn" value="查询" onClick="queryTradPartners(1)"/>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table id="channelInfoTable"  class="content_table_1">
						<thead>
							<tr class="f1">
			                  <th style="width:5%">选择</th>
			                  <th style="width:10%">合作伙伴代码</th>
			                  <th style="width:20%">合作伙伴名称</th>
			              	</tr>
						</thead>
						<tbody>
						</tbody>
					</table>
					<div id="channelInfoPageDIV"  class="page"></div>
				</td>
			</tr>
		</table>
		<div align="center" >
		  <input type="button" id="saveRoleBtn" value="确定" onclick="choosePartner()" class="input_button_3"/>&nbsp;&nbsp;&nbsp;
		  <input type="button" value="取消" onclick="closeCurrentDIV('channelInfoDiv')" class="input_button_3"/>
		</div>
	</div>	
</body>
</html>